#ifndef GLOBAL_H
#define GLOBAL_H

#define	MAX_NODE_NUMBER						300
#define MAX_RUNNING_TIME					1000
#define MAX_CHANNEL_NUMBER					5
#define NUM_OF_TEST_CASE					300

#define HUMAN_CONTACT_DISTANCE				10
#define STEPX								100
#define STEPY								100
#define WANTS_TO_FORWARD_MSG_TEENAGER		0.7
#define WANTS_TO_FORWARD_MSG_COMPUTERGEEK	0.2
#define WANTS_TO_FORWARD_MSG_GRANDPARENTS	0.5
#define WANTS_TO_FORWARD_MSG_HOUSEWIFE		0.9
#define WANTS_TO_FORWARD_MSG_BUSINESSMAN	0.4

#define SEND_DELAY_EMAIL					30
#define SEND_DELAY_OSN						20
#define SEND_DELAY_SMS						15
#define SEND_DELAY_PHONE					1
#define SEND_DELAY_HUMANCONTACT				5

#define TRANSMISSION_DELAY_EMAIL			200
#define TRANSMISSION_DELAY_OSN				500
#define TRANSMISSION_DELAY_SMS				150
#define TRANSMISSION_DELAY_PHONE			100
#define TRANSMISSION_DELAY_HUMANCONTACT		10

#define TRANSMISSION_DELAY_DISTANCE_DISCOUNT_FACTOR		100

#define RECEIVE_DELAY_EMAIL					100
#define RECEIVE_DELAY_OSN					70
#define RECEIVE_DELAY_SMS					15
#define RECEIVE_DELAY_PHONE					1
#define RECEIVE_DELAY_HUMANCONTACT			5

//#define 

enum UserType{
	TEENAGER = 0,
	COMPUTERGEEK,
	GRANDPARENTS,
	HOUSEWIFE,
	BUSINESSMAN
};

enum ChannelType{
	EMAIL = 0,
	OSN,
	SMS,
	PHONE,
	HUMANCONTACT
};

enum EventType
{
	NODE_EVENT = 0,
	SEND_EVENT,
	RECV_EVENT
};

// everyone should own one channel list (length = 5)
// which explains his/her actual situation in this channel
// at this time, we assume the preference, send delay, and recv delay
// won't change by time given one specific user
typedef struct _channelInfo{
	int channelID;
	float channelSendBaseDelay;
	float channelReceiveBaseDelay;
}channelInfo;

typedef struct _neighbor {
	int nodeID;
	_neighbor* next;
}neighbor;

// so far each time we only test one message, and we do not care whether
// the message has been sent to a specific node already
typedef struct _messageInfo{
	int messageID;
	int channelNumber;
	int senderID;
	int recipientID;
	int messageTimestamp;
	bool hasRead;
}messageInfo;

// channelPreference will be set as: (the following numbers are only for illustration purpose)
// channel 1: 20%: 0.2					(0.0 ~ 0.2)
// channel 2: 30%: 0.2 + 0.3 = 0.5		(0.2 ~ 0.5)
// channel 3: 15%: 0.5 + 0.15 = 0.65	(0.5 ~ 0.65)
// channel 4: 25%: 0.65 + 0.25 = 0.9	(0.65 ~ 0.9)
// channel 5: 10%: 0.9 + 0.1 = 1;		(0.9 ~ 1.0)
typedef struct _node {
	int ID;
	int userType;
	int neighbor_number;
	int locationx;
	int locationy;
	int on;
	bool hasSentTheSameMessage;
	float sendDelayFactor;
	float recvDelayFactor;
	float channelPreference[MAX_CHANNEL_NUMBER];
	neighbor *recipientList;
	neighbor *nearby;
	messageInfo* message;
}node;



typedef struct _element
{
	int nodeID;
	int clock;
	int on;
	EventType eventType;
	struct _element *next;
	messageInfo *message;
}element;

class global{
public:
	static int timeNow;
	static int messageID;
	static int nodesReceivedMessage;
};

#endif GLOBAL_H